const express = require('express');
const router = express.Router();
const paymentController = require('../controllers/payment.controller');
const { authMiddleware } = require('../middlewares/auth.middleware');

// 创建支付订单
// POST /api/payments/create
router.post('/create', authMiddleware, paymentController.createPayment);

// 查询支付状态
// GET /api/payments/:paymentId/status
router.get('/:paymentId/status', authMiddleware, paymentController.getPaymentStatus);

// 取消支付
// POST /api/payments/:paymentId/cancel
router.post('/:paymentId/cancel', authMiddleware, paymentController.cancelPayment);

// 模拟支付处理（仅用于开发测试）
// POST /api/payments/simulate
router.post('/simulate', authMiddleware, paymentController.simulatePayment);

// 支付宝回调通知（不需要认证）
// POST /api/payments/alipay/notify
router.post('/alipay/notify', paymentController.handleAlipayNotify);

module.exports = router;
